import axios from 'axios'

const baseURL = 'http://localhost:3000'

const instance = axios.create({
  baseURL,
  timeout: 10000,
})

const apis = {
  getAll() {
    return instance.get('/users')
  },
  getOne(id) {
    return instance.get(`/users/${id}`)
  },
  create(data) {
    return instance.post('/users', data)
  },
  update(id, data) {
    return instance.put(`/users/${id}`, data)
  },
  delete(id) {
    return instance.delete(`/users/${id}`)
  },
}

export default apis